package com.sky.mapper.common;

import com.sky.pojo.OrderDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface OrderDetailMapper {
    void batchInert(List<OrderDetail> details);

    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> getByOrderId(Long orderId);

    @Select("select name, number from order_detail where order_id = (select id from orders where number = #{orderNumber})")
    List<OrderDetail> findDetailsByNumber(String orderNumber);

    List<Map<String, Object>> top10(@Param("begin") String begin,
                                    @Param("end") String end);
}
